package tech.xs.workflow.service.impl;

import org.springframework.stereotype.Service;
import tech.xs.common.framework.service.CrudServiceImpl;
import tech.xs.workflow.bpmn.element.ProcessElement;
import tech.xs.workflow.dao.BpmnProcessDao;
import tech.xs.workflow.domain.entity.BpmnProcess;
import tech.xs.workflow.service.BpmnProcessService;

import javax.annotation.Resource;

@Service
public class BpmnProcessServiceImpl extends CrudServiceImpl<BpmnProcessDao, BpmnProcess> implements BpmnProcessService {

    @Resource
    private BpmnProcessDao bpmnProcessDao;

    @Override
    public BpmnProcess importProcess(ProcessElement processElement) {
        BpmnProcess bpmnProcess = new BpmnProcess();
        bpmnProcess.setNodeId(processElement.getId());
        bpmnProcessDao.insert(bpmnProcess);
        return bpmnProcess;
    }

}
